<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"
%><%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"
%><%@ taglib prefix="spring" uri="http://www.springframework.org/tags"
%><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"
%><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
%>
<head>
    <title><fmt:message key="folder" /></title>
</head>
<body>
    <h1><fmt:message key="folder" /></h1>
    <c:url var="updateUrl" value="/domain/folder/update"/>
    <form:form action="${updateUrl}" id="folderForm" modelAttribute="folderForm" >
        <form:errors cssClass="error"/>
        <table>
            <form:hidden path="folder.inode"/>
            <tbody>
                <tr>
                    <th><fmt:message key="folder_siteInode" /></th>
                    <td><c:out value="${folderForm.folder.site.inode}-${folderForm.folder.site.name}" /></td>
                </tr>
                <tr>
                    <th><fmt:message key="folder_path" /> *</th>
                    <td>
                        <form:input path="folder.path" readonly="true" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "folder.path",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : true
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="folder.path"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="folder_title" /> *</th>
                    <td>
                        <form:input path="folder.title"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "folder.title",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : true
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="folder.title"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="folder_friendlyName" /> *</th>
                    <td>
                        <form:input path="folder.friendlyName"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "folder.friendlyName",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : true,
									maxLength: 120
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="folder.friendlyName"/>
                    </td>
                </tr>

                <tr>
                    <th><fmt:message key="folder_indexPath" /> </th>
                    <td>
                        <form:input path="folder.indexPath"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "folder.indexPath",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false,
									maxLength: 120
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="folder.indexPath"/>
                    </td>
                </tr>

                <tr>
                    <th><fmt:message key="folder_listPath" /> </th>
                    <td>
                        <form:input path="folder.listPath"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "folder.listPath",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false,
									maxLength: 120
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="folder.listPath"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="folder_itemPath" /> </th>
                    <td>
                        <form:input path="folder.itemPath"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "folder.itemPath",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false,
									maxLength: 120
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="folder.itemPath"/>
                    </td>
                </tr>

                <tr>
                    <th><fmt:message key="folder_showOnMenu" /></th>
                    <td>
                        <form:checkbox id="folder.showOnMenu" path="folder.showOnMenu"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "folder.showOnMenu",
                                widgetType : "dijit.form.CheckBox",
                                widgetAttrs : {
                                    checked: ${folderForm.folder.showOnMenu != null ? folderForm.folder.showOnMenu : false}
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="folder.showOnMenu"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="folder_sortOrder" /></th>
                    <td>
                        <form:input path="folder.sortOrder"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "folder.sortOrder",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                    ,regExp : "[-+]?[0-9]+(\.[0-9]+)?"
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="folder.sortOrder"/>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="folder_filesMasks" /></th>
                    <td>
                        <form:input path="folder.filesMasks"/>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "folder.filesMasks",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="folder.filesMasks"/>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="2">
                        <div class="buttons">
                            <button id="updateButton" type="submit"><fmt:message key="label.form.submit"/></button>
                            <script type="text/javascript">
                                Spring.addDecoration(new Spring.ValidateAllDecoration({
                                    elementId:'updateButton',
                                    event:'onclick'
                                }));
                            </script>
                            <c:url var="showUrl" value="/domain/folder/show">
                                <c:param name="folder.inode" value="${folderForm.folder.inode}"/>
                            </c:url>
                            <a href="${showUrl}"><span><fmt:message key="label.link.show"/></span></a>
                        </div>
                    </td>
                </tr>
            </tfoot>
        </table>
    </form:form>
</body>
